package com.beyondcreative.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

import com.beyondcreative.stylebean.R;

public class BeanView extends View {

	private AnimateDrawable mDrawable;
	private Animation an;
	static boolean isAlreadySaw;

	public BeanView(Context context) {
		super(context);
		setFocusable(true);
		setFocusableInTouchMode(true);
		// drawable setting
		Drawable dr = context.getResources().getDrawable(
					R.drawable.stylebean0);
		dr.setBounds(0, 0, dr.getIntrinsicWidth(), dr.getIntrinsicHeight());
		// setting animation
		an = new TranslateAnimation(0, 200, 0, 800);
		an.setDuration(3000);
		an.initialize(10, 10, 10, 10);
		
		
		mDrawable = new AnimateDrawable(dr, an);
	}

	public void setIsAlreadySaw(boolean flag) {
		isAlreadySaw = flag;
	}

	@Override
	protected void onDraw(Canvas canvas) {
//		canvas.drawColor(Color.WHITE);
		mDrawable.draw(canvas);
		invalidate();
	}
}
